
add_definitions(
-DUNICODE
-D_UNICODE
)

set( SRC_LIST
	${PUBLIC_HEADERS}/w32.h
	MainWindow.h
	MainWindow.cpp
#	win32exports.pkg
#	${CMAKE_CURRENT_BINARY_DIR}/win32exports.cpp
)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})

add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/win32exports.cpp
                     COMMAND ${TOLUABIN} -o ${CMAKE_CURRENT_BINARY_DIR}/win32exports.cpp win32exports.pkg
                     MAIN_DEPENDENCY win32exports.pkg
                     DEPENDS MainWindow.h
                     WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
                     COMMENT "generate luabinding...")
                     
set(PROJECT_NAME "w32")
add_library(${PROJECT_NAME} SHARED ${SRC_LIST})


target_link_libraries(${PROJECT_NAME}
#	lua51
#	tolua++
	imm32.lib
	vfw32.lib
	d3d9.lib
)


set_target_properties(${PROJECT_NAME} 
	PROPERTIES 
	LINK_FLAGS "/EXPORT:CreateMessageLoop" 
)

install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${INSTALL_DIR})
install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${INSTALL_DIR}/Lib)
#install(FILES MainWindow.h DESTINATION ${INCLUDE_DIR} )
